<?php
class Admin_Form_Productitem extends Zend_Form
{
    public function init()
    {
        $this->setName("admin");

        $id = new Zend_Form_Element_Hidden('id');
        $id->addFilter('Int');
        
        $name = new Zend_Form_Element_Text('name');
        $name->setLabel('Tên danh mục (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $name->setAttrib('size', 60);
        
        $cat = new Zend_Form_Element_Select('catId');
        $cat->setLabel('Danh Mục Rao Vặt Cấp 1');          
        $modeC = new Admin_Model_Productcat();                
        $catL = $modeC->getAllData();        
        foreach($catL as $o){
            $cat->addMultiOption($o->id,$o->name);                  
        } 
        
        $ord = new Zend_Form_Element_Text('ord');
        $ord->setLabel('Thứ tự')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('Int');
        $ord->setAttrib('size', 10);
        
        $display = new Zend_Form_Element_Checkbox('display');
        $display->setLabel('Hiển thị');                        

        // submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id','submitbutton');
        $submit->setAttrib('class',"button medium");
                
        // add elements to form
        $this->addElements(array (
            $id, $cat, $name, $ord, $display, $submit
        ));
    }
}

